<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

final class Recept extends BIT_Model
{
	public static $class_name = __CLASS__;
	
	protected $id;
	
	protected $namn;
	
	protected $ravara;
	
	protected $huvud_ingrediens;

	protected $ingredienser;
	
	protected $typ;

	protected $tid;

	protected $onske;

	protected $tillagning;

	protected $personer;

	protected $copyright;
	
	private $db = "";
	
	function __construct(){
		parent::__construct();
	}
	
	public static function getRecipeList($limit = 5){
		$db = get_instance()->db;
		return $db->order_by('id' ,'desc')->limit($limit)->get('recept')->result();
	}

	public function getProductRelatedRecipes( $ravara, $limit=999 ){
		$db = get_instance()->db;
		return $db->order_by('rating', 'desc')->where('ravara', $ravara)->limit($limit)->get('recept')->result();
	}
}